package com.example.weiba_app;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;

public class NewsListAdapter extends BaseAdapter{
	private int resourceId;
	private TextView uname;
	private Context context;
	private ImageButton header;
	private Button reviewbtn;
	private List<? extends Map<String, ?>> data;
	
	
	public NewsListAdapter(Context aboutreview, List<? extends Map<String, ?>> data) {
		this.context = aboutreview;
		this.data = data;
		
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		LinearLayout item = (LinearLayout) View.inflate(context,R.layout.activity_newslist, null);
		final Map<String,String> map = (Map<String, String>) data.get(position);
		final Button btn = (Button) item.findViewById(R.id.button);
		//Object a = map.get("id");
		btn.setText(map.get("content"));
//		if (a.equals("1")) {
//			//btn.setText(map.get("content"));
//			//btn.setBackgroundColor(-20561);
//		} else {
//			//btn.setText(map.get("content"));
//			//btn.setBackgroundColor( -16776961);
//		}

		return item;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return this.data.size();
	}
	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return this.data.get(arg0);
	}
	@Override
	public long getItemId(int arg0) {
		return 0;
	}
	
}
